package com.zrrd._0727;

import java.io.*;

public class TestReader {
   public static void main(String[] args) {
      Reader reader = null;
      try {
         File file = new File("yuan.txt");
         reader = new FileReader(file);
         char[] chars = new char[(int)file.length()];
         reader.read(chars);//读到内存当中
         System.out.println(new String(chars));//打印出yuan.txt中的文件内容
         reader.close();

      } catch (FileNotFoundException e) {
         throw new RuntimeException(e);
      } catch (IOException e) {
         throw new RuntimeException(e);
      } finally {
         try {
            if(reader!=null){
               reader.close();
            }
         } catch (IOException e) {
            throw new RuntimeException(e);
         }
      }

   }
}
